home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3s / stdio.z / stdio
Encoding:
Text File  |  1998-10-20  |  6.5 KB  |  133 lines

  1.  
  2.  
  3.  
  4. SSSSTTTTDDDDIIIIOOOO((((3333SSSS))))                                                            SSSSTTTTDDDDIIIIOOOO((((3333SSSS))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      stdio - standard buffered input/output package
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
  13.  
  14.      FFFFIIIILLLLEEEE ****ssssttttddddiiiinnnn,,,, ****ssssttttddddoooouuuutttt,,,, ****ssssttttddddeeeerrrrrrrr;;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The functions described in the entries of sub-class 3S of this manual
  18.      constitute an efficient, user-level I/O buffering scheme.  The in-line
  19.      macros _g_e_t_c(3S) and _p_u_t_c(3S) handle characters quickly.  The macros
  20.      _g_e_t_c_h_a_r and _p_u_t_c_h_a_r, and the higher-level routines _f_g_e_t_c, _f_g_e_t_s, _f_p_r_i_n_t_f,
  21.      _f_p_u_t_c, _f_p_u_t_s, _f_r_e_a_d, _f_s_c_a_n_f, _f_w_r_i_t_e, _g_e_t_s, _g_e_t_w, _p_r_i_n_t_f, _p_u_t_s, _p_u_t_w, and
  22.      _s_c_a_n_f all use or act as if they use _g_e_t_c and _p_u_t_c; they can be freely
  23.      intermixed.
  24.  
  25.      A file with associated buffering is called a _s_t_r_e_a_m and is declared to be
  26.      a pointer to a defined type FFFFIIIILLLLEEEE.  _f_o_p_e_n(3S) creates certain descriptive
  27.      data for a stream and returns a pointer to designate the stream in all
  28.      further transactions.  Normally, there are three open streams with
  29.      constant pointers declared in the <stdio.h> header file and associated
  30.      with the standard open files:
  31.  
  32.           ssssttttddddiiiinnnn     standard input file
  33.           ssssttttddddoooouuuutttt    standard output file
  34.           ssssttttddddeeeerrrrrrrr    standard error file
  35.  
  36.      The following symbolic values in <_u_n_i_s_t_d._h> define the file descriptors
  37.      that will be associated with the C-language _s_t_d_i_n, _s_t_d_o_u_t and _s_t_d_e_r_r when
  38.      the application is started:
  39.  
  40.           SSSSTTTTDDDDIIIINNNN____FFFFIIIILLLLEEEENNNNOOOO     Standard input value, _s_t_d_i_n.  It has the value of
  41.                            0.
  42.           SSSSTTTTDDDDOOOOUUUUTTTT____FFFFIIIILLLLEEEENNNNOOOO    Standard output value, _s_t_d_o_u_t.  It has the value of
  43.                            1.
  44.           SSSSTTTTDDDDEEEERRRRRRRR____FFFFIIIILLLLEEEENNNNOOOO    Standard error value, _s_t_d_e_r_r.  It has the value of
  45.                            2.
  46.  
  47.      A constant NNNNUUUULLLLLLLL (0) designates a nonexistent pointer.
  48.  
  49.      An integer-constant EEEEOOOOFFFF (-1) is returned upon end-of-file or error by
  50.      most integer functions that deal with streams (see the individual
  51.      descriptions for details).
  52.  
  53.      An integer constant BBBBUUUUFFFFSSSSIIIIZZZZ specifies the size of the buffers used by the
  54.      particular implementation.
  55.  
  56.      An integer constant FFFFIIIILLLLEEEENNNNAAAAMMMMEEEE____MMMMAAAAXXXX specifies the size needed for an array
  57.      of _c_h_a_r large enough to hold the longest file name string that the
  58.      implementation guarantees can be opened.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSTTTTDDDDIIIIOOOO((((3333SSSS))))                                                            SSSSTTTTDDDDIIIIOOOO((((3333SSSS))))
  71.  
  72.  
  73.  
  74.      An integer constant FFFFOOOOPPPPEEEENNNN____MMMMAAAAXXXX specifies the minimum number of files that
  75.      the implementation guarantees can be open simultaneously.  Note that no
  76.      more than 255 files may be opened via _f_o_p_e_n, and only file descriptors 0
  77.      through 255 are valid.
  78.  
  79.      Any program that uses this package must include the header file of
  80.      pertinent macro definitions, as follows:
  81.  
  82.           #include <stdio.h>
  83.  
  84.      The functions and constants mentioned in the entries of sub-class 3S of
  85.      this manual are declared in that header file and need no further
  86.      declaration.  The constants and the following ``functions'' are
  87.      implemented as macros (redeclaration of these names is perilous):  _g_e_t_c,
  88.      _g_e_t_c_h_a_r, _p_u_t_c, _p_u_t_c_h_a_r, _f_e_r_r_o_r, _f_e_o_f, _c_l_e_a_r_e_r_r, and _f_i_l_e_n_o.
  89.  
  90.      Output streams, with the exception of the standard error stream _s_t_d_e_r_r,
  91.      are by default buffered if the output refers to a file and line-buffered
  92.      if the output refers to a terminal.  The standard error output stream
  93.      _s_t_d_e_r_r is by default unbuffered, but use of _f_r_e_o_p_e_n [see _f_o_p_e_n(3S)] will
  94.      cause it to become buffered or line-buffered.  When an output stream is
  95.      unbuffered, information is queued for writing on the destination file or
  96.      terminal as soon as written; when it is buffered, many characters are
  97.      saved up and written as a block.  When it is line-buffered, each line of
  98.      output is queued for writing on the destination terminal as soon as the
  99.      line is completed (that is, as soon as a new-line character is written or
  100.      terminal input is requested).  _s_e_t_b_u_f(3S) or _s_e_t_v_b_u_f(3S) in _s_e_t_b_u_f(3S)
  101.      may be used to change the stream's buffering strategy.
  102.  
  103. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  104.      open(2), close(2), lseek(2), pipe(2), read(2), write(2), ctermid(3S),
  105.      cuserid(3S), fclose(3S), ferror(3S), fopen(3S), fread(3S), fseek(3S),
  106.      getc(3S), gets(3S), popen(3S), printf(3S), putc(3S), puts(3S), scanf(3S),
  107.      setbuf(3S), system(3S), tmpfile(3S), tmpnam(3S), ungetc(3S).
  108.  
  109. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  110.      Invalid _s_t_r_e_a_m pointers will usually cause grave disorder, possibly
  111.      including program termination.  Individual function descriptions describe
  112.      the possible error conditions.
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.